﻿<phone:PhoneApplicationPage 
    x:Class="GrimorioApplication.Views.EditRecipe"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True">

    <phone:PhoneApplicationPage.Resources>
        <DataTemplate x:Key="IngredientList">
            <Grid Margin="0,0,0,15" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.8*"/>
                    <ColumnDefinition Width=".2*" />
                </Grid.ColumnDefinitions>
                <StackPanel  Orientation="Horizontal" Grid.Column="0" VerticalAlignment="Center">
                    <TextBlock  Text="{Binding Path=ingredientQuantity}" FontSize="24" Margin="0,0,5,0" TextWrapping="Wrap" />
                    <TextBlock  Text="{Binding Path=ingredientName}" FontSize="24" TextWrapping="Wrap" Margin="5,0" />
                </StackPanel>
                <Image Grid.Column="1" Source="/Img/AppIcons/deleteIconGrey.png" Tap="DeleteIngredientFromList" MaxHeight="62" MaxWidth="62" VerticalAlignment="Center" HorizontalAlignment="Right"/>
            </Grid>
        </DataTemplate>
    </phone:PhoneApplicationPage.Resources>


    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <!--Pivot Control-->
        <controls:Pivot Title="GRIMORIO">
            <!--Pivot item one-->
            <controls:PivotItem Header="{Binding LocalizedResources.item1_add_receipe, Source={StaticResource LocalizedStrings}}">
                <Grid>
                    <ScrollViewer>
                        <StackPanel Orientation="Vertical" Visibility="Visible">
                            <TextBlock x:Name="label_receipePhoto" Text="{Binding LocalizedResources.label_receipePhoto, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                            <Image x:Name="recipePhoto" Source="/Img/Grimorio_62_62_gray-01.png" Height="300" Tap="recipePhoto_Tap_1" MinHeight="200" MinWidth="400" DataContext="{Binding}" />
                            <toolkit:Rating x:Name="ratingStars" AllowHalfItemIncrement="False"  AllowSelectingZero="False"/>

                            <TextBlock x:Name="label_receipeName" Text="{Binding LocalizedResources.label_receipeName, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                            <TextBox x:Name="recipeName" MinWidth="400" HorizontalAlignment="Right" FlowDirection="RightToLeft"/>

                            <TextBlock x:Name="label_receipeDescription" Text="{Binding LocalizedResources.label_receipeDescription, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                            <TextBox x:Name="recipeBreifDescription" MinWidth="400" HorizontalAlignment="Right" FlowDirection="RightToLeft"/>

                            <TextBlock x:Name="label_numberOfPeople" Text="{Binding LocalizedResources.label_recipeNumberOfPeople, Source={StaticResource LocalizedStrings}}" FontSize="36"/>
                            <TextBox x:Name="recipeNumberOfPeople" InputScope="Number" MinWidth="400" HorizontalAlignment="Right" FlowDirection="RightToLeft"/>

                            <TextBlock x:Name="label_recipeDish" Text="{Binding LocalizedResources.label_recipeDish, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                            <toolkit:ListPicker x:Name="recipeDishListPicker" Width="375" HorizontalAlignment="Right" HorizontalContentAlignment="Right" FlowDirection="RightToLeft"/>

                            <TextBlock x:Name="label_receiepVegetarian" Text="{Binding LocalizedResources.label_receiepVegetarian, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                            <CheckBox x:Name="reciepVegetarian" IsChecked="False" HorizontalAlignment="Right"/>

                            <TextBlock x:Name="label_receipeDifficulty" Text="{Binding LocalizedResources.label_receipeDifficulty, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                            <toolkit:ListPicker x:Name="recipeDifficultyListPicker" Width="375" HorizontalAlignment="Right" HorizontalContentAlignment="Right" FlowDirection="RightToLeft"/>

                            <TextBlock x:Name="label_receipeTime" Text="{Binding LocalizedResources.label_receipeTime, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                            <TextBox x:Name="recipeTime" MinWidth="400" HorizontalAlignment="Right" FlowDirection="RightToLeft"/>

                            <TextBlock x:Name="label_receipeMatchings" Text="{Binding LocalizedResources.label_receipeMatchings, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                            <TextBox x:Name="recipeMatchings" MinWidth="400" HorizontalAlignment="Right" FlowDirection="RightToLeft"/>

                        </StackPanel>
                    </ScrollViewer>
                </Grid>
            </controls:PivotItem>

            <!--Pivot item two-->
            <controls:PivotItem  Loaded="PivotItem_Loaded" Header="{Binding LocalizedResources.item2_add_receipe, Source={StaticResource LocalizedStrings}}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height=".2*"/>
                        <RowDefinition Height=".8*"/>
                    </Grid.RowDefinitions>
                        <!-- Modificare con un bottone  più "cool" -->
                        <Button Grid.Row="0" x:Name="AddQIng" Content="{Binding LocalizedResources.add, Source={StaticResource LocalizedStrings}}" Click="AddQIng_Click" MinHeight="75" />

                        <!-- Lista con ingredienti e quantità -->
                    <toolkit:LongListSelector Grid.Row="1" x:Name="IgredientsList"  ItemTemplate="{StaticResource IngredientList}" IsFlatList="True">

                    </toolkit:LongListSelector>
                </Grid>
            </controls:PivotItem>


            <!--Pivot item three-->
            <controls:PivotItem Header="{Binding LocalizedResources.item3_add_receipe, Source={StaticResource LocalizedStrings}}">
                <Grid>
                    <ScrollViewer>
                        <TextBox x:Name="recipePreparation" MinHeight="400" TextWrapping="Wrap" TextAlignment="Left" />
                    </ScrollViewer>

                </Grid>
            </controls:PivotItem>
        </controls:Pivot>
    </Grid>
</phone:PhoneApplicationPage>